package com.example.a02glide;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.RequestManager;
import com.example.a02glide.utils.ContentViewInject;
import com.example.a02glide.utils.CustomInject;
import com.example.a02glide.utils.OnClick;
import com.example.a02glide.utils.ToastUtils;
import com.example.a02glide.utils.ViewInject;

@ContentViewInject(R.layout.activity_main)
public class MainActivity extends AppCompatActivity {
    @ViewInject(R.id.img)
    ImageView img;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        CustomInject.initCustomInject(this);


        String url = "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png";
//        Glide.with(this).load(url).into(img);//正常写法

        RequestManager with = Glide.with(this);
        RequestBuilder<Drawable> load = with.load(url);
        load.into(img);


    }

    @OnClick({R.id.img})
    public void onClick(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.img:

                ToastUtils.show("测试注解时间");

                break;
        }
    }
}